package com.huping.mapper;

import com.alibaba.fastjson.JSONObject;
import com.huping.pojo.Teacher;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface TeacherMapper {

    @Insert("insert into teacher (teacher_id, name, gender, phone, email) VALUES (#{teacherId},#{name},#{gender},#{phone},#{email})")
    int teacherInsert(Teacher teacher);

    @Update("update teacher set phone=#{phone},name=#{name},email=#{email},gender=#{gender} where teacher_id=#{teacherId}")
    int updateTeacherInformation(Teacher teacher);

    @Select("select * from teacher where teacher_id=#{userid}")
    Teacher getTeacherInformationByUserid(String userid);

    @Select("select teacher.name from teacher,sc where sc.student_id=#{userid} and sc.course_id=#{courseId} and teacher.teacher_id=sc.teacher_id")
    Teacher courseDetailsStudentGetTeacherName(String userid,String courseId);

    List<Map<String,Object>> getAllStudentsHomeworkByHomeworkId(Integer homeworkId);

}
